﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Proggy.Sandbox.HashingConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            // password
            var password = "hereismypassword";

            // get hash
            var hash = PasswordHash.CreateHash(password);
            
            // ask for password
            Console.WriteLine("What is your password? (It's \"hereismypassword\")");
            var askedForPassword = Console.ReadLine();

            // see if password was correct
            Console.Write("Was that correct? Checking");
            Thread.Sleep(200);
            Console.Write(".");
            Thread.Sleep(200);
            Console.Write(".");
            Thread.Sleep(200);
            Console.Write(".");
            Thread.Sleep(200);
            Console.Write(".");
            Thread.Sleep(200);
            Console.Write(".");

            // get correct
            var correct = PasswordHash.ValidatePassword(askedForPassword, hash);

            // check
            if (correct)
            {
                Console.WriteLine("\n\nYES!!");
            }
            else {
                Console.WriteLine("\n\nNO!!");
            }

            //
            Console.WriteLine("\n\nBy the way, the hash is \n\n{0}", hash);

            //
            Console.WriteLine("\n\nPress any key to start again.");

            //
            Console.ReadKey();

            //
            Console.Clear();

            //
            Main(args);
        }
    }
}
